package aad.storyboard;



import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.ArrayList;

import org.xml.sax.InputSource;

import utils.MyXMLHandler;
import utils.ScriptParser;
import utils.ViewUtils;
import aad.storyboard.controller.ControllerManager;
import aad.storyboard.controller.GUIComposer;
import aad.storyboard.controller.MenuViewProvider;
import aad.storyboard.controller.StoryTimer;
import aad.storyboard.model.Chapter;

import aad.storyboard.model.Circle;
import aad.storyboard.model.Layer;
import aad.storyboard.model.*;
import aad.storyboard.model.Scene;
import aad.storyboard.model.Script;
import aad.storyboard.model.Story;
import aad.storyboard.model.menu.Menu;
import aad.storyboard.model.menu.MenuProvider;
import aad.storyboard.model.menu.PlainCentralizedMenuBuilder;
import aad.storyboard.view.MenuViewCreator;




import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.ViewFlipper;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Typeface;

public class Test extends Activity{



private StoryTimer timer;

private MediaPlayer mediaplayer;
private Context context;

private ViewFlipper flipper;



SeekBar volControl=null;

AudioManager audioManager;
int maxVolume;
int curVolume;


private ImageButton media=null;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
	   this.setContentView(R.layout.viewflipper);
    context=this;
    
    Story s = Story.getInstance();
    ControllerManager.getInstance().setupControllers(s,this,R.id.mainlayout);


	
	   InputSource is = new InputSource(getResources().openRawResource(R.raw.story));
	   MyXMLHandler handler=new MyXMLHandler();
	   handler.getXMLdata(is);
	   s.setAudioFile(R.raw.fulljabber);
	   Chapter c=Story.getInstance().getChapters().get(0);
	   s.setCurrentChapter(c);
	   c.setStartTime(0);
	   c.setEndTime(1000000);
	   c.setCurrentScene(c.getScenes().get(0));	

	  this.createScene13(c.getScenes().get(12));
	   this.createScene14(c.getScenes().get(13));
	   this.createScene15(c.getScenes().get(14));
	   this.createScene16(c.getScenes().get(15));
	   this.createScene17(c.getScenes().get(16));
	   this.createScene18(c.getScenes().get(17));
/*Image jabberwocky;
ImageProvider provider = ImageProvider.getInstance(getResources());
	   try {
		jabberwocky= provider.getImage(R.raw.jabberwocky);
	      jabberwocky.setPercentagePosX(65);
	      jabberwocky.setPercentagePosY(65);
	      jabberwocky.setPercentageHeight(100);//has to be 100 and scale to 90
	     
	      ScaleAnimation scale1 = new ScaleAnimation(0.8f, 0.8f,2,114000);
	      AnimationProvider.getInstance().addAnimation(jabberwocky, scale1, AnimationProvider.EVENT_NONE);
	      Layer l = new Layer();
		   l.addGraphicalObject(jabberwocky);
	      c.getScenes().get(13).addLayer(0, l);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}     */
	   
		 //ControllerManager.getInstance().startStory();
    ViewUtils.intitialize(this);
    MenuViewCreator creator = MenuViewCreator.getInstance(this);
    PlainCentralizedMenuBuilder builder = new PlainCentralizedMenuBuilder(s);
    MenuViewProvider.setup(s, builder, creator);
    this.setContentView(MenuViewProvider.getInstance().getMainMenuView());

}

@Override
public void onDestroy() {
       super.onDestroy();
       ControllerManager.getInstance().getAdapter().close();
       ControllerManager.getInstance().getFRC().stop();
       //AudioPlayer.setState(0);
       //AudioPlayer.stopPlayer();
       mediaplayer.release();
}

public void createScene13(Scene scene)
{


	   Image beamishboy,jabberwocky, tree;
	   ImageProvider provider = ImageProvider.getInstance(this.getResources());
	   try {
	      beamishboy= provider.getImage(R.raw.beamish_boy);		      
	      beamishboy.setPercentagePosX(130);
	      beamishboy.setPercentagePosY(80);
	      beamishboy.setPercentageHeight(70);   
	      
	     
	      tree=provider.getImage(R.raw.tumtum);
	      tree.setPercentagePosX(100);
	      tree.setPercentagePosY(55);
	      tree.setPercentageHeight(90); 
	      
	      MoveAnimation move=new MoveAnimation(-ViewUtils.percentWidthToPixels(35), 0, 3,114000);
	     
	      ArrayList <Image> images=new ArrayList <Image>();
	      images.add(beamishboy);
	      images.add(tree);
	      
		  AnimationProvider acontroller = AnimationProvider.getInstance();
		  acontroller.addAnimation(images, move, AnimationProvider.EVENT_NONE);
		 
		  jabberwocky=provider.getImage(R.raw.jabberwocky);
		  jabberwocky.setPercentagePosX(80);
	      jabberwocky.setPercentagePosY(60);
	      jabberwocky.setPercentageHeight(60);
	      jabberwocky.getPaint().setAlpha(0);
	  
	      FadeAnimation fadein=new FadeAnimation(114000,3, false, 140);
	      fadein.addImage(jabberwocky);
	      acontroller.addAnimation(fadein, AnimationProvider.EVENT_NONE);
	      
	      Paint paint =new Paint ();
	      paint.setColor(Color.RED);
	      Circle circle1= new Circle(8, ViewUtils.percentWidthToPixels(79), ViewUtils.percentHeightToPixels(48), paint.getColor());
	      Circle circle2= new Circle(8, ViewUtils.percentWidthToPixels(84), ViewUtils.percentHeightToPixels(47), paint.getColor());
	      
	      BlinkAnimation blink=new BlinkAnimation(114000, 3);
	      blink.addGraphicalObject(circle1);
	      blink.addGraphicalObject(circle2);	     
	      acontroller.addAnimation(blink, AnimationProvider.EVENT_NONE);		      
	      
	      
	      InfoAnimation info=new InfoAnimation(114000, 3, this);
	      info.addImage(beamishboy); 		  
	     
	      beamishboy.setInfo("<html><body><h1>Beamish</h1><p>Radiantly beaming, happy, cheerful.</p></body></html>");
	      beamishboy.setClickableWord("happy");
	      
	      acontroller.addAnimation(info, AnimationProvider.EVENT_TOUCH);
	      
	      Layer l1 = new Layer();
		   Layer l2 = new Layer();
		   Layer l3=new Layer ();
		   Layer l4=new Layer ();
		   Layer l5=new Layer ();

			  Image bg = provider.getImage(R.drawable.landscape);
			  bg.setPercentageHeight(100);
			  bg.setPercentagePosX(50);
			  bg.setPercentagePosY(50);
			  l5.addGraphicalObject(bg);
		   l1.addGraphicalObject(beamishboy);
		   l2.addGraphicalObject(tree);
		   l3.addGraphicalObject(circle1);
		   l3.addGraphicalObject(circle2);
		   l4.addGraphicalObject(jabberwocky);
		   
		   scene.addLayer(0, l1);
		   scene.addLayer(1, l2);
		   scene.addLayer(2, l3);
		   scene.addLayer(3, l4);
		   scene.addLayer(4, l5);
	      
	   } catch (Exception e) {
	       e.printStackTrace();			       
		
	   }
}  

public void createScene14(Scene scene)
{

	   Image beamishboy,jabberwocky, tree;
	   ImageProvider provider = ImageProvider.getInstance(this.getResources());
	   try {
	      beamishboy= provider.getImage(R.raw.beamish_boy);		      
	      beamishboy.setPercentagePosX(95);
	      beamishboy.setPercentagePosY(80);
	      beamishboy.setPercentageHeight(70);   
	      
	      MoveAnimation move1=new MoveAnimation(ViewUtils.percentWidthToPixels(140), 0, 8,119000);
	      
		  AnimationProvider acontroller = AnimationProvider.getInstance();
		  acontroller.addAnimation(beamishboy, move1, AnimationProvider.EVENT_NONE);
		    
	     
	      tree=provider.getImage(R.raw.tumtum);
	      tree.setPercentagePosX(65);
	      tree.setPercentagePosY(55);
	      tree.setPercentageHeight(90); 
	      
	      MoveAnimation move2=new MoveAnimation(ViewUtils.percentWidthToPixels(-140), 0, 8,119000);
		  acontroller.addAnimation(tree, move2, AnimationProvider.EVENT_NONE);
		 
		  jabberwocky=provider.getImage(R.raw.jabberwocky);
		  jabberwocky.setPercentagePosX(70);
	      jabberwocky.setPercentagePosY(50);
	      jabberwocky.setPercentageHeight(40);
	      jabberwocky.getPaint().setAlpha(255);
	      InfoAnimation info2=new InfoAnimation(119000,8,this);
			 jabberwocky.setInfo("<html><body><h1>Jabberwocky</h1><p>When a class in the Girls' Latin School in Boston asked Carroll's permission to name their school magazine The Jabberwock, he replied 'The Anglo-Saxon word 'wocer' or 'wocor' signifies 'offspring' or 'fruit'. Taking 'jabber' in its ordinary acceptation of 'excited and voluble discussion.'</p></body></html>");
		     jabberwocky.setClickableWord("Jabberwocky");
			 info2.addImage(jabberwocky);
			 acontroller.addAnimation(info2, AnimationProvider.EVENT_TOUCH);
	      ScaleAnimation scale1 = new ScaleAnimation(2f,2f,8,119000);
	      acontroller.addAnimation(jabberwocky,scale1, AnimationProvider.EVENT_NONE);
	      InfoAnimation info=new InfoAnimation(119000, 8, this);
	      info.addImage(beamishboy); 		  
	     
	      beamishboy.setInfo("<html><body><h1>Beamish</h1><p>Radiantly beaming, happy, cheerful.</p></body></html>");
	      beamishboy.setClickableWord("happy");
	      
	      acontroller.addAnimation(info, AnimationProvider.EVENT_TOUCH);
	      MoveAnimation move3 = new MoveAnimation(ViewUtils.percentWidthToPixels(-20),0,5,119000);
	      acontroller.addAnimation(jabberwocky,move3, AnimationProvider.EVENT_NONE);
	      ArrayList<Image> images = new ArrayList<Image>();
	      ScaleAnimation scale2 = new ScaleAnimation(1.1f,1.1f,2,119000);
	      images.add(tree);
	      images.add(beamishboy);
	      acontroller.addAnimation(images,scale2, AnimationProvider.EVENT_NONE);

	      Layer l1 = new Layer();
		   Layer l2 = new Layer();
		   Layer l3=new Layer ();
		   Layer l5=new Layer ();

			  Image bg = provider.getImage(R.drawable.landscape);
			  bg.setPercentageHeight(100);
			  bg.setPercentagePosX(50);
			  bg.setPercentagePosY(50);
			  l5.addGraphicalObject(bg);
		   l1.addGraphicalObject(beamishboy);
		   l2.addGraphicalObject(tree);
		   l3.addGraphicalObject(jabberwocky);
		  // l4.addGraphicalObject(wood);
		   
		   
		   scene.addLayer(0, l1);
		   scene.addLayer(1, l2);
		   scene.addLayer(2, l3);
		  scene.addLayer(3, l5);
		  scene.addLayer(4, l5);
	      
	      
	   } catch (Exception e) {
	       e.printStackTrace();
	   }
	}

public void createScene15(Scene scene)
{

	   Image jabberwocky, sword,wood;
	   ImageProvider provider = ImageProvider.getInstance(this.getResources());
	   try {
			  wood = provider.getImage(R.drawable.tugleywood);
			  wood.setPercentageHeight(110);
			  wood.setPercentagePosX(50);
			  wood.setPercentagePosY(50);
	      sword= provider.getImage(R.drawable.vorpal);		      
	      sword.setPercentagePosX(50);
	      sword.setPercentagePosY(80);
	      sword.setPercentageHeight(40);   
	      
		  AnimationProvider acontroller = AnimationProvider.getInstance();
		    
	      ShakeAnimation sa = new ShakeAnimation(100,ViewUtils.percentHeightToPixels(15),11,130000);
	     
	      
		  jabberwocky=provider.getImage(R.raw.jabberwocky);
		  jabberwocky.setPercentagePosX(48);
	      jabberwocky.setPercentagePosY(48);
	      jabberwocky.setPercentageHeight(80);
	      jabberwocky.getPaint().setAlpha(255);
	      
	      ScaleAnimation scale1 = new ScaleAnimation(1.4f, 1.4f, 9,131000);
	      
	      ScaleAnimation scale2 = new ScaleAnimation(0.9f,0.9f,1,130000);
	      

	      ScaleAnimation scale3 = new ScaleAnimation(0.9f,0.9f,1,132000);

	      ScaleAnimation scale4 = new ScaleAnimation(0.9f,0.9f,1,135000);
	      

	      ScaleAnimation scale5 = new ScaleAnimation(1.5f, 1.5f, 9,131000);
	      
	      acontroller.addAnimation(jabberwocky,scale1, AnimationProvider.EVENT_NONE);
	      acontroller.addAnimation(jabberwocky,scale2, AnimationProvider.EVENT_NONE);
	      acontroller.addAnimation(jabberwocky,scale3, AnimationProvider.EVENT_NONE);
	      acontroller.addAnimation(jabberwocky,scale4, AnimationProvider.EVENT_NONE);
	      acontroller.addAnimation(sword,scale5, AnimationProvider.EVENT_NONE);
	      
	      sa.addImage(jabberwocky);
	      sa.addImage(wood);
	      sa.addImage(sword);
		  acontroller.addAnimation(sa, AnimationProvider.EVENT_NONE);
	      MoveAnimation ra1 = new MoveAnimation(ViewUtils.percentWidthToPixels(15),ViewUtils.percentHeightToPixels(-15), 1,134000);
	      MoveAnimation ra2 = new MoveAnimation(ViewUtils.percentWidthToPixels(-15),ViewUtils.percentHeightToPixels(-25), 1,135000);
	      MoveAnimation ra3 = new MoveAnimation(ViewUtils.percentWidthToPixels(15),ViewUtils.percentHeightToPixels(25), 1,135000);
	      MoveAnimation ra4 = new MoveAnimation(ViewUtils.percentWidthToPixels(-15),ViewUtils.percentHeightToPixels(15), 1,135000);
	      acontroller.addAnimation(sword,ra1, AnimationProvider.EVENT_NONE);
	      acontroller.addAnimation(sword,ra2, AnimationProvider.EVENT_NONE);
	      acontroller.addAnimation(sword,ra3, AnimationProvider.EVENT_NONE);
	      acontroller.addAnimation(sword,ra4, AnimationProvider.EVENT_NONE);
	      
	      ParticleEffect effect=new ParticleEffect(500, 300, 290, Color.RED);
			 ParticleAnimation particles=new ParticleAnimation(4,135000);
			 effect.setAlpha(0);
			 particles.addGraphicalObject(effect);
			 acontroller.addAnimation(particles, AnimationProvider.EVENT_NONE);
			 InfoAnimation info1=new InfoAnimation(131000, 8, this);
			 sword.setInfo("<html><body><h1>Vorpalsword</h1><p>Describes the young boy's quest to slay the Jabberwocky</p></body></html>");
		     sword.setClickableWord("Jabberwocky");
			 info1.addImage(sword);
			 
			 InfoAnimation info2=new InfoAnimation(131000,8,this);
			 jabberwocky.setInfo("<html><body><h1>Jabberwocky</h1><p>When a class in the Girls' Latin School in Boston asked Carroll's permission to name their school magazine The Jabberwock, he replied 'The Anglo-Saxon word 'wocer' or 'wocor' signifies 'offspring' or 'fruit'. Taking 'jabber' in its ordinary acceptation of 'excited and voluble discussion.'</p></body></html>");
		     jabberwocky.setClickableWord("Jabberwocky");
			 info2.addImage(jabberwocky);
			 acontroller.addAnimation(info2, AnimationProvider.EVENT_TOUCH);
			 acontroller.addAnimation(info1, AnimationProvider.EVENT_TOUCH);
	      
	      Layer l1 = new Layer();
		   Layer l2 = new Layer();
		   Layer l3=new Layer ();
		   Layer l5=new Layer ();

			  Image bg = provider.getImage(R.drawable.landscape);
			  bg.setPercentageHeight(100);
			  bg.setPercentagePosX(50);
			  bg.setPercentagePosY(50);
			  l5.addGraphicalObject(bg);
		   l1.addGraphicalObject(sword);
		   l2.addGraphicalObject(jabberwocky);
		   l2.addGraphicalObject(effect);
		   //l3.addGraphicalObject(wood);
		   
		   
		   scene.addLayer(0, l1);
		   scene.addLayer(1, l2);
		   scene.addLayer(2, l3);
			  scene.addLayer(3, l5);
		  // scene.addLayer(3, l4);      
	      
	      
	   } catch (Exception e) {
	       e.printStackTrace();
	   }

	}
public void createScene16(Scene scene)
{

	   Image jabberwocky, vorpalsword;
	   ImageProvider provider = ImageProvider.getInstance(this.getResources());
	   try {
		   
		  
		   
	      jabberwocky= provider.getImage(R.raw.jabberwocky);     
	      jabberwocky.setPercentagePosX(60);
	      jabberwocky.setPercentagePosY(60);
	      jabberwocky.setPercentageHeight(100);//has to be 100 and scale to 90
	     
	      ScaleAnimation scale1 = new ScaleAnimation(0.8f, 0.8f,2,146000);
	      MoveAnimation move=new MoveAnimation(0, -65, 3,145000);		  
	      AnimationProvider acontroller=AnimationProvider.getInstance();
	      acontroller.addAnimation(jabberwocky, scale1, AnimationProvider.EVENT_NONE);	
	      acontroller.addAnimation(jabberwocky, move, AnimationProvider.EVENT_NONE);	
	     
	      vorpalsword=provider.getImage(R.drawable.vorpal);
	      vorpalsword.setPercentagePosX(60);
	      vorpalsword.setPercentagePosY(65);
	      vorpalsword.setPercentageHeight(70);//has to be at 150	      
	      
		 ParticleEffect effect=new ParticleEffect(500, 320, 320, Color.RED);
		 ParticleAnimation particles=new ParticleAnimation(3,149000);
		 particles.addGraphicalObject(effect);
		 acontroller.addAnimation(particles, AnimationProvider.EVENT_NONE);
		 
		 InfoAnimation info1=new InfoAnimation(145000, 5, this);
		 vorpalsword.setInfo("<html><body><h1>Vorpalsword</h1><p>Describes the young boy's quest to slay the Jabberwocky</p></body></html>");
	     vorpalsword.setClickableWord("Jabberwocky");
		 info1.addImage(vorpalsword);
		 
		 InfoAnimation info2=new InfoAnimation(145000,5,this);
		 jabberwocky.setInfo("<html><body><h1>Jabberwocky</h1><p>When a class in the Girls' Latin School in Boston asked Carroll's permission to name their school magazine The Jabberwock, he replied 'The Anglo-Saxon word 'wocer' or 'wocor' signifies 'offspring' or 'fruit'. Taking 'jabber' in its ordinary acceptation of 'excited and voluble discussion.'</p></body></html>");
	     jabberwocky.setClickableWord("Jabberwocky");
		 info2.addImage(jabberwocky);
		 acontroller.addAnimation(info1, AnimationProvider.EVENT_TOUCH);
		 acontroller.addAnimation(info2, AnimationProvider.EVENT_TOUCH);
	      
	      

	       Layer l1 = new Layer();
		   Layer l2 = new Layer();
		   Layer l3=new Layer ();
		   Layer l4=new Layer ();
		  Layer l5 = new Layer();
		  Image bg = provider.getImage(R.drawable.landscape);
		  bg.setPercentageHeight(100);
		  bg.setPercentagePosX(50);
		  bg.setPercentagePosY(50);
		  l5.addGraphicalObject(bg);
		   l1.addGraphicalObject(vorpalsword);
		   l3.addGraphicalObject(jabberwocky);
		   l2.addGraphicalObject(effect);
		  		   
		   scene.addLayer(0, l1);
		   scene.addLayer(1, l2);
		   scene.addLayer(2, l3);
		   scene.addLayer(3, l4);
			  scene.addLayer(4, l5);
	      
	      
	   } catch (Exception e) {
	       e.printStackTrace();
	       
	   }
	
}

public void createScene17(Scene scene)
{
	Image jabberwocky, vorpalsword;
	ImageProvider provider = ImageProvider.getInstance(this.getResources());
	try {	
	
	 jabberwocky=provider.getImage(R.raw.jabberwocky);
	 jabberwocky.setPercentagePosX(65);
     jabberwocky.setPercentagePosY(55);
     jabberwocky.setPercentageHeight(80);
     
     vorpalsword=provider.getImage(R.raw.beamish_boy);
     vorpalsword.setPercentagePosX(60);
     vorpalsword.setPercentagePosY(65);
     vorpalsword.setPercentageHeight(70);
	      
	ColorFadeAnimation colorfade=new ColorFadeAnimation(146000, 10, Color.RED, true);	
	colorfade.addImage(jabberwocky);
	colorfade.addImage(vorpalsword);
	
	 AnimationProvider acontroller = AnimationProvider.getInstance();	 
	 acontroller.addAnimation(colorfade, AnimationProvider.EVENT_NONE);
	 
	 	Layer l1 = new Layer();
	   Layer l2 = new Layer();
	  Layer l5 = new Layer();
	  Image bg = provider.getImage(R.drawable.landscape);
	  bg.setPercentageHeight(100);
	  bg.setPercentagePosX(50);
	  bg.setPercentagePosY(50);
	  l5.addGraphicalObject(bg);
	   
	   l1.addGraphicalObject(jabberwocky);
	   l2.addGraphicalObject(vorpalsword);	 
	  
	   
	   scene.addLayer(0, l1);
	   scene.addLayer(1, l2);
		  scene.addLayer(2, l5);
	  
	 
	 } catch (Exception e) {
	       e.printStackTrace();
	       
	   }
}


public void createScene18(Scene scene)
	{

		Image jabberwocky, beamishboy,hills,castle;
		ImageProvider provider = ImageProvider.getInstance(this.getResources());
		try {	
			
	 jabberwocky=provider.getImage(R.drawable.jhead);
	 jabberwocky.setPercentagePosX(60);
     jabberwocky.setPercentagePosY(68);
     jabberwocky.setPercentageHeight(20);
     
     
     hills = provider.getImage(R.drawable.hills);
     hills.setPercentageHeight(95);
     hills.setPercentagePosX(50);
     hills.setPercentagePosY(70);
     
     castle = provider.getImage(R.drawable.castle);
     castle.setPercentageHeight(15);
     castle.setPercentagePosX(30);
     castle.setPercentagePosY(70);
     
     MoveAnimation move1 = new MoveAnimation(0,ViewUtils.percentHeightToPixels(20),5,161000);
     MoveAnimation move2 = new MoveAnimation(ViewUtils.percentHeightToPixels(15),ViewUtils.percentHeightToPixels(-30),5,161000);
     
     
     beamishboy=provider.getImage(R.raw.beamish_boy);
     beamishboy.setPercentagePosX(70);
     beamishboy.setPercentagePosY(50);
     beamishboy.setPercentageHeight(30);

     InfoAnimation info=new InfoAnimation(161000, 8, this);
     info.addImage(beamishboy); 		  
    
     beamishboy.setInfo("<html><body><h1>Beamish</h1><p>Radiantly beaming, happy, cheerful.</p></body></html>");
     beamishboy.setClickableWord("happy");
     
     
     MoveAnimation move3 = new MoveAnimation(ViewUtils.percentHeightToPixels(-10),ViewUtils.percentHeightToPixels(-10),7,161000);
     move3.addImage(jabberwocky);
     move3.addImage(beamishboy);
	      
	ColorFadeAnimation colorfade=new ColorFadeAnimation(161000, 10, Color.RED, false);	
	colorfade.addImage(jabberwocky);
	colorfade.addImage(beamishboy);
	
	 AnimationProvider acontroller = AnimationProvider.getInstance();	 
	 acontroller.addAnimation(colorfade, AnimationProvider.EVENT_NONE);
	 acontroller.addAnimation(hills,move1, AnimationProvider.EVENT_NONE);
	 acontroller.addAnimation(castle,move2, AnimationProvider.EVENT_NONE);
	 acontroller.addAnimation(move3, AnimationProvider.EVENT_NONE);

     acontroller.addAnimation(info, AnimationProvider.EVENT_TOUCH);
	   Layer l1 = new Layer();
	   Layer l2 = new Layer();
	   Layer l3 = new Layer();
	   Layer l4 = new Layer();
	  
	   
	   l1.addGraphicalObject(jabberwocky);
	   l2.addGraphicalObject(beamishboy);
	   l3.addGraphicalObject(hills);
	   l4.addGraphicalObject(castle);
	  
	   scene.addLayer(0, l1);
	   scene.addLayer(1, l2);
	   scene.addLayer(2, l3);
	   scene.addLayer(3, l4);
	  
	   
	 
	 } catch (Exception e) {
	       e.printStackTrace();
	       
	   }
}
}